DIRSIZE v2.8
============

Copyright 1993-1997 Simon A Carter

The Directory Size/Wastage Lister with the Lot:

    *  Summary statistics for multi-level directories. This is very useful
       for finding the complete size of applications before deletion or
       backup.
    *  Displays Windows 95 long filenames.
    *  The directories to be displayed can be limited by their size or
       depth; very useful for eliminating unnecessary detail.
    *  For the selected drive, displays actual cluster size, free space,
       used space and capacity.
    *  For each directory tree specified, displays cluster size (user-
       selectable), total space used and wastage (as a percentage or as a
       total).
    *  For each directory displayed, shows total space, wasted space (as a
       percentage or as a total), and if it has subdirectories, the total
       space used by the directory and all of its subdirectories.
    *  Shows wasted space for a given cluster size - optimise your cluster
       size before repartitioning your hard disk.
    *  Rounds up file sizes to the cluster size for the most accurate size
       information.
    *  Size/wastage information includes the size of directories
       themselves.
    *  Paginates output, [Enter] for next line, [Esc] to exit and any
       other key for next page. Disabled automatically if output is
       redirected.
    *  Output can be redirected to a file or to the printer or into
       another program.
    *  The characters used to draw the directory tree can be changed from
       DOS extended ASCII characters to standard ASCII characters for
       other operating systems.
    *  Comma-delimited and tab-delimited output formats for easy importing
       into databases, spreadsheets or word processors for further
       analysis or specialised printing.
    *  Directory sorting can be disabled.
    *  Future proof - directory sizes up to 99 GB are catered for.
    *  Progress indicator as it accumulates file information.


DirSize is SHAREWARE, and may be trialed for 30 days. If you find DirSize
useful and plan to continue using it after this period, you must pay the
registration fee of $5 by going to Albert's Ambry, http://www.alberts.com.
Please register on the DirSize mailing list by sending email to Simon
Carter at launch@ozemail.com.au, with your name and any comments.

Please see the end of this file for more registration information.


What will DirSize do for me ?
=============================

DirSize shows a graphical tree of the directories on your hard disk. The
tree starts from the current directory, or from a directory or directories
that you specify. The left column displays the total disk space used by
each directory. Directories that contain further sub-directories display
summary statistics in square brackets after the directory name. This is
very useful for determining the complete size of an application, for
example, if you were hunting for an application to remove to make way for
a new one. Alternatively, DirSize can be used to find the total size of an
application before a backup or copy is made.

DirSize automatically detects and displays Windows 95 long filenames. Of
course, it will still run under any older version of DOS.


Installation
============

Just copy DIRSIZE.EXE to a directory in your path, for example, to C:\DOS.
To find out the directories in your path, type

   c:\> path    [Enter]


How to use DirSize
==================

Typing

   dirsize -?   [Enter]

on its own will display usage information.

Usage:
   dirsize [options]

Where [options] is one or more of:
<directory>   Default: Current path
              
              One or more directories can be specified as the starting
              point for DirSize's output. For a DirSize of drives a:, b:
              and the current directory (c:\windows) type:
              
              c:\windows> dirsize a:\ b:\ .
              
              Directory names with special characters such as spaces must
              be entered with double quotes e.g.
              
              c:\> dirsize "Program Files" "windows\start menu"   [Enter]
              
              You can perform multiple DirSize command in a single run
              e.g.
              
              c:\> dirsize -1 c:\ -0 d:\
              
-nosort       Do not sort directory names into alphabetical order (the
              default). This may be useful if you are comparing DirSize's
              output to an unsorted listing from the DOS DIR command.
              
-p            Do not paginate the output. Pagination pauses after each
              screenful of output. [Enter] shows the next line, [Esc]
              exits, [End] scrolls continuously to the end of the output,
              and any other key shows the next screen full of output.
              Pagination is automatically disabled when the output is
              redirected.
              
-size=#       Only show directories that use # space or larger. A K, M or
              G suffix can be used to express the value in KBytes (1024
              bytes), MBytes (1024 KBytes) or GBytes (1024 Mbytes). This
              is very useful for finding network space hogs, or for
              eliminating small directories that are of no consequence
              from the display.
              
-cl=#         Show how much disk space would be wasted if the cluster size
              was set to # bytes per cluster. # is restricted by DOS to
              powers of two, but for convenience DirSize allows it to be
              set to any value. This is useful for previewing the result
              of a change in cluster size on a set of files. In general,
              the smaller the cluster size, the smaller the wasted space.
              As for -size=# above, a K, M or G suffix can be used.
              
-dir          Give the same results as a DIR - excluding all wastage
              information.
              
-#            Default: All levels (255)
              
              Limits the number of levels of directories displayed to the
              given value. Eg /1 will only show the first directory level.
              The statistics will include all levels, but they will not be
              displayed. This is very useful if you just need to find out
              how much total space is in use by an application without
              caring how it is divided into sub-directories. A value of 0
              is equivalent to a value of 255 (i.e. all levels).
              
-comma        Print the result in a comma-delimited output format suitable
              for importing into a spreadsheet, database or word
              processor.
              
-tab          Same as -comma above but outputs in tab-delimited format.
              
-nowaste      Do not show wasted space for each directory. The wasted
              space is still included in the totals - it is just not shown
              as a display column.
              
-asval        Show the actual wasted space per directory rather than as a
              percentage of the directory's used space.
              
-c<+|->       Control which characters to use for drawing lines.
              
              + Uses DOS's graphical line drawing characters even if it
              detects that its output is being redirected.
              - Uses portable text line drawing characters even if it
              detects that its output is not being redirected. This is
              useful if the result is going to be used on another
              computer, for example, on a Unix machine or a Macintosh.
              
              Note: When DirSize detects that its output is being
              redirected, it automatically turns off pagination, and
              selects portable characters to draw lines, such as +, - and
              |. It does this because the output may be sent to a device
              or another computer that does not understand DOS's line
              drawing characters (which are non-portable). When DirSize's
              output goes to the screen, it uses the DOS line drawing
              characters. You can override the default behaviour in either
              case using the -c option


DirSize Environment Variable
----------------------------

If you regularly use the same settings for DirSize, you can set them in
the environment variable DirSize. This variable is processed before
command line options, so anything specified on the command line will
override it.

e.g.

   SET DIRSIZE=-nowaste -c- -nosort


Redirecting Output
------------------

DirSize's output can be redirected to any device. For example, to save
DirSize's output to the file output.txt, you can type:

   dirsize > output.txt    [Enter]

To add DirSize output to an existing file exists.txt, type

   dirsize >> exists.txt    [Enter]

To send DirSize's output to the printer, type

   dirsize > prn    [Enter]


DirSize Example
---------------

The output below was generated from running DirSize in the Program Files
directory (in a DOS shell under Windows 95). All directories smaller than
2 MB have been removed from display:

   c:\> dirsize -size=2M "Program Files"    [Enter]
   DirSize v2.8  Copyright (c) 1993-1997 Simon Carter
   
   Total space     Wstd  Directory name   [dir + subdirs total]
   --------------  ----  ----------------------------------------------
           32,768   97%  C:\Program files   [253,329,408]
           32,768   99%  |--Borland   [98,500,608]
           32,768   99%  |  |--Common Files   [4,358,144]
        4,325,376   10%  |  |  +--Bde
        4,096,000    6%  |  |--Database Desktop
          229,376   37%  |  +--Delphi 2.0   [90,013,696]
        9,207,808    9%  |     |--Bin   [9,699,328]
           32,768   98%  |     |--Demos   [18,710,528]
        5,898,240   35%  |     |  |--Data
           32,768   98%  |     |  |--Db   [4,292,608]
           32,768   98%  |     |  +--Doc   [3,735,552]
       30,670,848    2%  |     |--Help   [32,833,536]
        2,162,688    6%  |     |  +--Tools
           32,768   99%  |     |--Images   [8,355,840]
        5,341,184   98%  |     |  +--Buttons
        9,863,168   58%  |     |--Lib
        1,212,416   96%  |     |--Objrepos   [2,097,152]
        2,293,760    2%  |     |--Quickrpt
          557,056   58%  |     +--Source   [3,112,960]
           32,768   99%  |--Common Files   [16,547,840]
           32,768   98%  |  +--Microsoft Shared   [16,515,072]
        2,293,760    4%  |     |--Msgraph5
        2,883,584    6%  |     +--Proof
        3,047,424   38%  |--Games
        5,275,648   17%  |--Jobint
        6,684,672   19%  |--Norton AntiVirus   [7,274,496]
        2,326,528    7%  |--Norton Commander   [2,359,296]
        9,011,200    9%  |--Norton Utilities   [15,007,744]
        5,996,544   19%  |  +--System
       11,370,496    3%  |--Painter3   [15,826,944]
          753,664   17%  |--Plus!   [2,457,600]
        5,603,328   14%  |--Resumew   [10,027,008]
        3,342,336   67%  |  +--Resumes
        2,162,688   32%  |--VendInfo
        4,194,304    3%  |--Visio   [21,200,896]
        2,752,512   14%  |  |--Add-ons
        3,244,032    5%  |  |--Help
           32,768   99%  |  |--Stencils   [4,882,432]
        4,849,664   10%  |  |  +--Standard
          163,840   52%  |  +--System   [4,751,360]
        2,162,688   23%  |     +--Filter32
        6,717,440    9%  |--Web3d   [37,715,968]
        1,245,184    4%  |  |--Catalog   [19,496,960]
        1,441,792   60%  |  |  |--Backdrop   [3,407,872]
        6,684,672   14%  |  |  |--Model
        2,752,512   53%  |  |  +--Surface   [4,554,752]
           32,768   99%  |  |--Samples   [3,407,872]
        2,654,208    7%  |  |  +--Stylebmp
          491,520    7%  |  +--Webstyle   [7,995,392]
          884,736   56%  |     +--Surface   [3,538,944]
        2,555,904    8%  +--Winres
   --------------  ----  ----------------------------------------------
      253,329,408   25%  Cluster size: 32,768  Wastage: 64,893,638
   --------------  ----  ----------------------------------------------
   
   Drive C: statistics:
      Cluster size:         32,768 bytes
        Free space:     26,247,168 bytes (2% of capacity is free)
        Used space:  1,061,486,592 bytes
          Capacity:  1,087,733,760 bytes


Note how all sizes shown (except the wasted space) are integral (whole)
multiples of the drive's cluster size.


What is the "Cluster Size" ?
============================

When your computer places files on a disk (both hard disks and floppy
disks), it must use an integral number of allocation units. The size of
the allocation units varies depending on the total capacity of the disk.
This means that if a file is smaller than one complete allocation unit, it
does not fill the entire allocation unit. For example, lets say we have a
file that is 300 bytes long. On a floppy disk with an allocation unit of
512 bytes, the file will only occupy the first 300 bytes, but since one
entire allocation unit must be used, the remaining 212 bytes are wasted. A
file 513 bytes long will occupy 2 allocation units, with 511 bytes wasted.
An allocation unit is called a CLUSTER. Floppy drives typically use a
cluster size of 512 bytes or 1,024 bytes, so not much space is wasted.
Hard disks range from 2,048 bytes (for a 106 MB drive) to 32,768 bytes
(for a 1.04 GB drive) and even 65,535 bytes, which means that a great deal
of space is wasted. The cluster size gets bigger with bigger disks for two
reasons:

   1)    A DOS limitation that sets an absolute upper maximum on the total
         number of clusters on a drive (65535).
   2)    The overhead of managing a large number of clusters consumes a
         lot of disk space that cannot be used for anything else.

The DOS DIR command always shows you the size actually in use by the file
- it does not include the extra 'wasted' space at the end of the cluster.
This wasted space is sometimes referred to as 'slack' space.


Directories use up clusters too
-------------------------------

DirSize takes into account the amount of disk space used to store the
entries within each directory. Normal file, directory and volume label
entries take up 32 bytes each. Long filename entries can consume between 1
and 32 additional directory entries (each of 32 bytes).

Even empty directories use a minimum of one cluster - for the current
directory "." and the parent directory ".." entries. The root directory
always consumes a fixed and pre-determined amount of disk space which
cannot be reclaimed, and DirSize excludes the number of entries in the
root directory from its calculations.

DirSize does not take into account the size of entries that are no longer
being used. This means that a directory that has had many files deleted
may display a size lower than that actually in use. DOS never reclaims
this extra space unless you delete the directory.

To reduce the amount of disk space used by directories, remove directories
that do not contain any files. Also, if you delete a large number of files
from one directory (particularly directories containing long filenames),
move the files to a new directory, remove the old one and then rename the
new directory to the original name.


Lost clusters
-------------

Clusters can become orphaned when DOS is unable to complete changes to the
disk, for example, when you are forced to reboot your machine or when the
power is turned off accidentally. These clusters cannot be used until they
are identified and reclaimed. Use the DOS CHKDSK or SCANDISK command to
reclaim lost clusters. Lost clusters are considered to be used.


Reducing wasted space
=====================


What about Disk Compression ?
-----------------------------

Disk compression programs like Stacker and DoubleSpace are able to make
use of the wasted space because they take on the responsibility of storing
the files themselves. By doing so, they overcome DOS's integral cluster
size limitation. DirSize's space wasted information may be invalid on
volumes controlled by these programs, and on some later versions of file
servers.


What about archives ?
---------------------

Storing collections of files in a compressed or uncompressed archive saves
space, because by grouping all of the files into one large file, only a
small amount of space is wasted. The archive program uses its own format
to store the files without wasting space.


Partitions - decreasing the cluster size
----------------------------------------

Partitions subdivide a physical disk drive into a number of logical
drives. For example, a 500 MB hard disk could be partitioned into two
250MB partitions, C: and D:. The advantage of doing this is that the
cluster size can be smaller, and in general, the amount of wasted space
will be smaller. The disadvantage is that it takes time to set up (since
you have to move ALL of your data off the hard disk in order to partition
it, unless you have a program that can re-partition on the fly), and you
have to remember which drive your programs are on, and manage space across
two drives instead of one. For more information on partitions, see the DOS
FDISK command.


New features/Revision history
=============================

Date       Version   Changes Made
24-Feb-97  2.8       Added welcome and information screen.
                     Minor formatting change.
                     Removed % display shown since inaccurate.
                     Fixed screen scrolling.
                     Even faster!
21-Feb-97  2.7       Added ability to limit the directories shown based on
                     the amount of space they use.
                     Added DirSize environment variable.
                     Added option to totally ignore wasted space to give
                     the same totals as a DOS DIR command.
                     Changed command line options to have a - prefix
                     instead of /
14-Oct-96  2.6       Added wastage percentage/value to display.
                     Changed display format.
                     Added wastage information for each directory.
                     Increased speed (again).
                     Added comma-delimited and tab-delimited database
                     output formats.
                     Added the actual size of the entries in each
                     directory to the total size count.
                     Added ability to limit directory depth and to specify
                     multiple directories with separate parameters for
                     each.
24-Jun-96  2.5       Reduced stack usage further.
                     Added /nosort, /size=# and /p option.
                     Added automatic pagination.
                     Fixed bug for paths longer than 68 characters.
                     Re-instated stack checking.
13-Jun-96  2.4       Increased stack limit to 64K, and reduced stack
                     usage. This means that you can list directories that
                     are much deeper than before. Appreciably faster (11
                     seconds compared to 14 for a complete display of a
                     1.1 GB drive).
                     Now only shows usage information if /?, ? or -h given
                     as first parameter.
                     Email and address changes.
27-May-96  2.3       Documentation update.
8-May-96   2.2       Shows usage information if no parameters are
                     provided.
                     Fixed bug in long filename functions that prevented
                     them from working under some circumstances.
                     Fixed bug in file size rounding up function, which
                     made files that were an integral number of clusters
                     long one extra cluster long.
                     Documentation update.
28-Apr-96  2.1       First release.
3-Jul-93   1.0       First created and used.


Registration
============

DirSize is SHAREWARE, and may be trialed for 30 days. If you find DirSize
useful and plan to continue using it after this period, you must pay the
registration fee of $5 by going to Albert's Ambry, http://www.alberts.com.
Please register on the DirSize mailing list by sending email to Simon
Carter at launch@ozemail.com.au, with your name and any comments.

If you like and use DirSize, I'd also appreciate a postcard, a link from
your WWW home page or *any* other sort of recognition!


Online Web registration
-----------------------

The registered version of DirSize can be purchased and received
immediately on the Internet at Alberts Ambry. Registration at Alberts
also eliminates shipping and handling costs. Please go to:

  http://www.alberts.com/

Search on: dirsize

Click on the "Buy it" hotlink to register DirSize.

Order form
----------


    Personal details
    ----------------
    
           Name: ____________________________________________
        Company: ____________________________________________
        Address: ____________________________________________
                 ____________________________________________
                 ____________________________________________
                 ____________________________________________
          Phone: ____________________________________________
            Fax: ____________________________________________


    For Visa, MasterCard or Bank Card (*)
    -------------------------------------
    (Sorry, I currently do not accept American Express)
    
    Card Number: ____ ____ ____ ____
    Expiry Date: ____/______
    
    
      Signature: ________________________________
    
           Date: ____________
    
    (*) Please note that these orders are processed by Omnivision
    Technologies, a licensed distributor.
    
    
    Cheques
    -------
    I accept bank cheques and personal cheques drawn on an Australian
    bank. Foreign cheques cost me an additional $US 10 to cover my bank's
    foreign cheque charge. Please make cheques payable to Simon Carter.
    
    
    Postal money orders
    -------------------
    I accept prepaid postal money orders in Australian dollars.


Contact Information
===================

I am always happy to hear your comments! If you use and like DirSize, or
have any suggestions for improvements, please drop me a line!

  Email:  launch@ozemail.com.au
    WWW:  Checkout the Crystal Software home page at
          http://www.ozemail.com.au/~launch
    Fax:  +61-3 9800-3078  Any time.
  Voice:  +61-3 9809-0172  After hours number. Please leave a contact
          name, number and time, and I will try to get back to you within
          24 hours.
   Mail:  Simon Carter
          Crystal Software
          2 / 9 Woodbine Court
          Wantirna
          Victoria 3152
          AUSTRALIA.
    
